﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminMaster.Master" Inherits="System.Web.Mvc.ViewPage<VietThuongLMS.ViewModels.ChiNhanhViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <legend>
        <h2>
            Danh sách chi nhánh</h2>
    </legend>
    <%= Html.ActionLink("Thêm chi nhánh", "Create", "ChiNhanh", new { area = "Admin" }, new { @class = "btn btn-success" }) %>
    <table class="table table-hover table-striped">
        <thead>
            <tr>
                <th>
                    #
                </th>
                <th>
                    Tên chi nhánh
                </th>
                <th>
                    Địa chỉ
                </th>
                <th>
                    Hành động
                </th>
            </tr>
        </thead>
        <tbody>
            <% 
                if (@Model != null && @Model.List.Count > 0)
                {
                    int i = 1;
                    foreach (VietThuongLMS.ChiNhanh @ChiNhanh in @Model.List)
                    {%>
            <tr>
                <td>
                    <%=i%>
                </td>
                <td>
                    <%=@ChiNhanh.TenChiNhanh%>
                </td>
                <td>
                    <%=@ChiNhanh.DiaChi %>
                </td>
                <td>
                    <%= Html.ActionLink("Edit", "Edit", "ChiNhanh", new { area = "Admin", id = @ChiNhanh.ID }, new { @class = "btn btn-primary" })%>
                    <a href="#myModal_<%=i %>" class="btn btn-danger" data-toggle="modal">Delete</a>
                    <!-- Modal -->
                    <div id="myModal_<%=i %>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                        aria-hidden="true">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                ×</button>
                            <h3 id="myModalLabel">
                                Delete</h3>
                        </div>
                        <div class="modal-body">
                            <p>
                                Are you sure you want to delete <b>"<%=@ChiNhanh.TenChiNhanh%>"</b> ?</p>
                        </div>
                        <div class="modal-footer">
                            <button class="btn" data-dismiss="modal" aria-hidden="true">
                                No</button>
                            <%= Html.ActionLink("Delete", "Delete", "ChiNhanh", new { area = "Admin", @id = @ChiNhanh.ID }, new { @class = "btn btn-primary" })%>
                        </div>
                    </div>
                </td>
            </tr>
            <% i++;
                    }%>
            <tr>
                <td colspan="6">
                    <%
                        if ((string)ViewData["pageLinks"] != "")
                        { %>
                    <%= ViewData["pageLinks"] %>
                    <% } %>
                </td>
            </tr>
            <%
                }
                else
                {
            %>
            <tr>
                <td colspan="5" style="text-align: center;">
                    Empty List
                </td>
            </tr>
        </tbody>
    </table>
    <% }
    %>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
